package ClassWork.Work_03;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class MapDemo {
    public static void main(String[] args) {
        String str = "abcdayfakefadjkkal";
        Map<String, Integer> map = new HashMap<>();
        for (int i = 0; i < str.length(); i++) {
            String key = str.substring(i, i + 1);
            Integer value = map.get(key);
            if (value == null) {
                map.put(key, 1);
            }else{
                map.put(key, value+1);
            }
        }
        Set<String> keys = map.keySet();
        for (String key : keys) {
            int value = map.get(key);
            System.out.println(key + "：" + value);
        }
    }
}
